#ifndef _PHYSICS_H
#define _PHYSICS_H

#include "NxOgre.h"
#include "Ogre.h"

using namespace Ogre;
using namespace NxOgre;

//Config structure of the Physics System
struct PhysicsConfig {

	bool isInitialized;
	bool isTerrainActorLoaded;
	bool isSimulation;

	float Gravity;
	float Skin;
	float Restitution;
	float StaticFriction;
	float DynamicFriction;

	unsigned int actorsCount;
};
extern PhysicsConfig physics_config;

class PhysicsSystem
{
public:
	PhysicsSystem();
	~PhysicsSystem();
	
	void createScene(); //Create Scene's objects
	void createTerrainActor(); //Create the actor entity of the terrain, ETM must be loaded first
	void simulate(const Ogre::Real &time); //Simulate one frame
	void startSimulation(); //Start the simulation
	void stopSimulation(); //Stop the simulation
	void shutdown(); //Shutdown system
	void resetScene(); //Empty current scene
	void setDefaultConfig(); //Set default global parameters 
	NxOgre::World* getWorld();
	NxOgre::Scene* getScene();

private:

	World* mWorld;
	Scene* mScene;

	bool mIsInitialized;
	bool mIsRunningSim;

	float mGravity;
	float mSkin;
	float mRestitution;
	float mStaticFriction;
	float mDynamicFriction;
};

#endif
